

"""日志页面基类"""
from pages.base_page import BasePage
from selenium.webdriver.common.by import By


class LogHomePage(BasePage):
    url = '/crm/index.php?m=log'
    add_log_locator = (By.XPATH, '/html/body/div[5]/div[2]/div[2]/div/a')
    add_ok_locator = (By.CSS_SELECTOR,'body > div.container > div.alert.alert-success')
    #进展统计
    rizhi_tj_log_locator=(By.XPATH,'/html/body/div[5]/div[1]/ul/li[2]/a')
    #本周的
    thisweek_log_locator=(By.XPATH,'/html/body/div[5]/p/a[3]')
    #断言标题不能为空
    knowledge_add_false_title_locator = (By.CSS_SELECTOR, 'body > div.container > div.alert.alert-error')
    #断言内容不能为空
    knowledge_add_false_content_locator =(By.CSS_SELECTOR,'body > div.container > div.alert.alert-error')
    #点击工作报表
    work_baobiao_locator=(By.CSS_SELECTOR,'body > div.container > div.page-header > ul > li.active > a')
    #点击第一条知识
    first_knowledge_locator=(By.CSS_SELECTOR,'#form1 > table > tbody > tr:nth-child(1) > td:nth-child(1) > input')
    #点击删除
    knowledge_delete_locator=(By.CSS_SELECTOR,'#delete')


    #点击新增日志
    def btn_add_log(self):
        self.driver.find_element(*self.add_log_locator).click()
    #点击进展统计
    def click_log_tj(self):
        self.driver.find_element(*self.rizhi_tj_log_locator).click()

    #点击本周的
    def click_log_thisweek(self):
        self.driver.find_element(*self.thisweek_log_locator).click()
    #获取最后url
    def get_last_url(self):
        return self.current_url()
    #添加成功断言
    def add_log_ok(self):
        return self.driver.find_element(*self.add_ok_locator).text
    #添加标题不能为空断言
    def message_add_false_title(self):
        message_false_title = self.driver.find_element(*self.knowledge_add_false_title_locator).text
        return message_false_title

    # 添加日志内容不能为空断言
    def message_add_false_content(self):
        false_content = self.driver.find_element(*self.knowledge_add_false_content_locator).text
        return false_content
    #点击工作报表
    def click_work_baobiao(self):
        self.driver.find_element(*self.work_baobiao_locator).click()
    #点击第一条日志
    def click_first_log(self):
        self.driver.find_element(*self.first_knowledge_locator).click()
    #点击删除
    def click_log_delete(self):
        self.driver.find_element(*self.knowledge_delete_locator).click()
